<?xml version="1.0" encoding="UTF-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

<#--
 *  Copyright (c) 2004 The Open For Business Project - www.ofbiz.org
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a 
 *  copy of this software and associated documentation files (the "Software"), 
 *  to deal in the Software without restriction, including without limitation 
 *  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
 *  and/or sell copies of the Software, and to permit persons to whom the 
 *  Software is furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included 
 *  in all copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
 *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
 *  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
 *  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT 
 *  OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 
 *  THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 *@author     Leon Torres (leon@opensourcestrategies.com)
 *@version    $Rev: 418498 $
 *@since      3.2
-->

<#-- do not display columns associated with values specified in the request, ie constraint values -->

<fo:layout-master-set>
    <fo:simple-page-master master-name="main" page-height="11in" page-width="8.5in"
            margin-top="0.5in" margin-bottom="1in" margin-left="1in" margin-right="1in">
        <fo:region-body margin-top="1in"/>
        <fo:region-before extent="1in"/>
        <fo:region-after extent="1in"/>
    </fo:simple-page-master>
</fo:layout-master-set>
<#list departments as department>
    <#list department.people?sort_by("lastName") as person>
    <fo:page-sequence master-reference="main">
    <fo:static-content flow-name="xsl-region-before" font-family="Helvetica">
        <fo:block font-size="14pt">
            <fo:external-graphic src="url('http://aycu08.webshots.com/image/3407/1431549912123450904_rs.jpg')"/>
        </fo:block>
    </fo:static-content>
    <fo:static-content flow-name="xsl-region-after" font-family="Helvetica">
        <fo:block font-size="8pt">
          <fo:list-block padding-before="6pt">
               <fo:list-item>
                  <fo:list-item-label end-indent="3in" 
                                      font-size="10pt">
                    <#assign nowTimestamp = Static["org.ofbiz.base.util.UtilDateTime"].nowTimestamp()>
                    <fo:block text-align="start" font-size="10pt">Generated: ${nowTimestamp?string("MMM dd, yyyy")}</fo:block>
                  </fo:list-item-label>
                  <fo:list-item-body start-indent="3in">
                    <fo:block text-align="end" font-size="10pt">Document Version: 1.0</fo:block>
                  </fo:list-item-body>
            </fo:list-item>
          </fo:list-block>
        </fo:block>
    </fo:static-content>
    <fo:flow flow-name="xsl-region-body" 
             font-family="Helvetica">
        <fo:block border-color="gray"
          border-style="groove"
          border-width="medium"
          font-size="14pt"
          padding-bottom="30px">
          <fo:block font-size="14pt"
                      font-weight="bold">
          Name: ${person.lastName?lower_case?cap_first}, ${person.firstName?lower_case?cap_first}
          </fo:block>
          <fo:list-block border-bottom="1pt gray ridge" padding-after="6pt">
              <fo:list-item>
                  <fo:list-item-label end-indent="3in" 
                                      font-size="10pt">
                      <fo:block text-align="start" font-size="10pt">Department: ${department.groupName}</fo:block>
                  </fo:list-item-label>
                  <fo:list-item-body start-indent="3in">
                      <fo:block text-align="end" font-size="10pt">Hire Date: ${person.hireDate}</fo:block>
                  </fo:list-item-body>
              </fo:list-item>
          </fo:list-block>
        </fo:block>
        <fo:block padding-top="30px">
        </fo:block>
        <fo:block border-color="gray"
		          border-style="groove"
		          border-width="medium"
		          padding-bottom="5px">
            <fo:block font-size="14pt"
                text-align="center"
                padding-top="5px"
                padding-bottom="10px"
                font-weight="bold">
                Inservices
            </fo:block>
            <#assign totalTime = 0>
            <#assign TwoKFive = 0>
            <#assign TwoKSix = 0>
            <#list person.meetingList as meeting>
            <fo:block text-align="left"
              font-size="10pt">
              <#assign totalTime = totalTime + Static["java.lang.Double"].parseDouble(meeting.time.attrValue)>
			  <#assign year = meeting.datetimeStarted?string("yyyy")>
			  <#if year = "2005">
			  	<#assign TwoKFive = TwoKFive + Static["java.lang.Double"].parseDouble(meeting.time.attrValue)>
			  <#elseif year= "2006">
			  	<#assign TwoKSix = TwoKSix + Static["java.lang.Double"].parseDouble(meeting.time.attrValue)>			  
			  </#if>
                <fo:list-block border-bottom="1pt gray ridge" 
                               padding-after="6pt"
                               padding-top="20px">
                    <fo:list-item>
                        <fo:list-item-label end-indent="3in"
                                          font-size="10pt">
                            <fo:block text-align="start" font-size="14pt">${meeting.datetimeStarted?string("MMM dd, yyyy")} </fo:block>
                        </fo:list-item-label>
                        <fo:list-item-body start-indent="0in">
                            <fo:block text-align="end" font-size="14pt">${meeting.subject} - ${meeting.time.attrValue?if_exists} minutes</fo:block>
                        </fo:list-item-body>
                    </fo:list-item>
                </fo:list-block>
            </fo:block>
            </#list>
        </fo:block>
        <fo:block padding-top="30px">
            <fo:list-block border-bottom="1pt gray ridge" 
                           padding-after="6pt"
                           padding-top="20px">
                <fo:list-item padding-top="30px">
                    <fo:list-item-label end-indent="3in"
                                      font-size="10pt">
                        <fo:block text-align="start" font-size="14pt">Total Time in Meetings:</fo:block>
                    </fo:list-item-label>
                    <fo:list-item-body start-indent="3in">
                        <fo:block text-align="end" font-size="14pt">${totalTime} Minutes</fo:block>
                        <fo:block text-align="end" font-size="14pt">2005: ${TwoKFive} Minutes</fo:block>
                        <fo:block text-align="end" font-size="14pt">2006: ${TwoKSix} Minutes</fo:block>
                    </fo:list-item-body>
                </fo:list-item>
            </fo:list-block>
        </fo:block> 
    </fo:flow>
    </fo:page-sequence>
    </#list>
</#list>

</fo:root>
